let mysql = require("mysql");
let connection = mysql.createConnection({
    host     : 'localhost',
    user     : 'root',
    password : 'root',
    database : 'bookshop'
});

connection.connect();

// connection.query('SELECT * FROM books', function (error, results, fields) {
//     if (error) throw error;
//     console.log('The solution is: ', results);
//     console.log(fields);
// });
console.log(connection.query('SELECT * FROM books'));
console.log("查询完成");

// connection.query("insert into books(name, price, count, createDate) values('haha', 100, 10, now())", function (error, results, fields) {
//     if (error) throw error;
//     console.log('The solution is: ', results);
//     console.log(fields);
// });